This invention relates generally to displaying art and information in a computing environment and, more particularly, relates to rendering text along a curving baseline.
The natural sensitivity of humans to visual information and audio-visual cues makes graphical representation of information of central importance in facilitating the effective use of computers. The ever increasing speed of the modern processors and better algorithms for rendering graphical information have made possible visual interfaces such as that found in the xe2x80x9cWINDOWS(copyright)xe2x80x9d brand operating systems manufactured by xe2x80x9cMICROSOFT(copyright)xe2x80x9d corporation of Redmond, Wash.
In addition to developing user interfaces, this technology has also been used to create art, such as composing photographs, manipulating images, creating a virtual reality packed with, otherwise impossible, flights of fancy and the like. Moreover, the availability of affordable computing power has resulted in providing the average computer user with access to tools such as a variety of fonts for rendering text. Such capabilities, possible previously only with the aid of sophisticated typesetting skills, are now at the fingertips of an average child designing a greeting card on a computer. Underlying such achievements are techniques for efficiently manipulating graphical objects, including, typographic objects such as glyphs.
It is customary to regard typographic objects, such as those used for rendering text characters, as being somewhat different from ordinary graphical objects although they can be manipulated by similar methods. In part, the reasons have to do with the nature of transformations of text objects and the rules for their placement. Thus, in English the horizontal placement of characters (in reality it is glyphs corresponding to the desired characters that are placed) is varied to generate pleasing text, while in Arabic the glyphs are placed diagonally to each other in the same word. To add to this complexity there are rules for rendering cursive characters placed next to each other and rules for combining characters or using different shapes in different contexts requiring the use of particular glyphs. Since output devices usually handle digital data as pixels, which also characterize the resolution of the device, the glyphs are stepping stones for generating a collection of pixels to yield a bitmap.
In the xe2x80x9cTRUE TYPE(copyright)xe2x80x9d font specification, commonly used in the xe2x80x9cWINDOWS(copyright)xe2x80x9d brand operating systems manufactured by xe2x80x9cMICROSOFT(copyright)xe2x80x9d corporation of Redmond, Wash., a particular glyph is specified by a set of curves connecting a set of points, although bitmaps may be embedded as well. These curves defining the outline of the character may be advantageously specified by suitable polynomial or other expressions.
More precisely, a series of points connected by curves and lines is specified to define a character, as rendered in a particular glyph. Furthermore, xe2x80x9cTRUE TYPE(copyright)xe2x80x9d fonts include xe2x80x9chints,xe2x80x9d which are instructions for distorting the curves within a glyph-rectangle, which can be attached to the font.
When a user desires to graphically render a particular character, a corresponding glyph is identified taking into account the preceding and following character, language, style and the physical placement relative to vertical and/or horizontal references. Text strings are conveniently displayed by placing several such glyph-rectangles, usually side by side, along a reference line. The choice of a particular glyph is made by the use of a suitable set of lookup tables that provide the corrections necessary to give effect to different justification choices, fonts, hints and the like to generate many shapes from a starting template.
The notable feature in the scheme described above is that the font specifications and character manipulation rules are largely independent of the display device. The resolution at which curves are described in a glyph significantly exceeds the resolution of the best output devices available today. Thus, errors due to digitization of the outline in a particular glyph are not perceptible to ordinary observers and the outline may be described by equations that are converted into specific bits or points only when required to reduce potential loss of resolution. It should be noted that the description should not be interpreted to limit the disclosure to xe2x80x9cTRUE TYPE(copyright)xe2x80x9d technology. Other outline technologies are suitable for practicing the invention. Some additional examples of such technologies are xe2x80x9cPOSTSCRIPT(copyright)xe2x80x9d and vector fonts.
Two-dimensional graphical objects are customarily transformed using affine transformations, such as scaling, rotating, skewing, and translating, which transform parallel lines into parallel lines. In addition, non-affine transformations such as bilinear and perspective transforms are available. In a bilinear transform, as an example of a non-affine transform, a rectangle is transformed into a xe2x80x9cquad,xe2x80x9d i.e., a quadrilateral, such that any point along the edge of the rectangle becomes a point on the edge of the quad while retaining its relative position. A rectangle, itself, is a quad with the restriction that its opposite sides are parallel. This condition is relaxed for quads in general. In a perspective transform a two-dimensional image, treated as a projection of a three-dimensional object, is transformed to generate another projection. These transformations are discussed in the pending patent application xe2x80x9cMethod and Apparatus for Transforming and Rendering Graphical Curves,xe2x80x9d Ser. No. 09/452,658, filed on Dec. 1, 1999, which is incorporated by reference in its entirety in this application.
Typically, a straight reference line is used to predictably manage text strings. It is difficult to integrate editable text with typical glyphs placed along an arbitrarily curved reference line because in the presence of significant curvature of the reference line text is distorted in a manner that is less than pleasing. The context defined by the local curvature of the baseline is not reflected in the rendering of the characters contained in the text. Thus, the range and nature of transformations available for rendering text along curved baselines are in need of rules for adjusting the glyphs to account for the curvature in the baseline. The difficulty in satisfactorily obtaining such rules is made apparent by considering that a rather large number of glyph combinations are possible for arbitrarily curved reference lines, thus reducing the utility of lookup tables or other techniques for fast rendering of text strings on a curved reference line.
It should be noted that transformations of text along a straight reference line to yield a curved reference line with text might result by transformations other than those manipulating fonts directly. As an example, the U.S. Pat. No. 5,920,327 issued to Robert Seidensticker, Jr., describes rendering graphical objects at different resolutions within the same image to generate a xe2x80x98fish-eyexe2x80x99 view with apparently curved baselines when the graphic includes text strings. It does not, however, teach specifying an arbitrary curvature for the baseline or other reference lines or adjusting the curvature or font in course of rendering the text string.
The invention describes a method and system for rendering text along an arbitrarily curved reference line by transforming the text to reflect the curvature of the reference line. Thus the overall effect of the curved text is more pleasing as the individual characters are transformed in a manner closely following the local curvature of the reference line. An embodiment teaches positioning and orienting the glyphs corresponding to the text string to take into account the curvature of the reference line. In addition, optional xe2x80x9cwarpingxe2x80x9d of the individual glyphs is possible to present a pleasing appearance.
The transformation from a rectangle to a corresponding xe2x80x9cquadxe2x80x9d results in a warping of the character in accordance with a specified transformation. The local curvature is used to deduce a suitable number of xe2x80x9cquadsxe2x80x9d on the curved reference line corresponding to the rectangles on a straight reference line within which defined portions of text characters, termed glyphs, are rendered in a manner specified by a font. The font specification is typically in the form of a collection of curves describing the outlines of a glyph. Thus, a transformation is provided from a straight reference line to a curved reference line, such that text rendered relative to the straight reference line is transformed into text relative to the curved reference line by also transforming the curves defining the outlines of the individual glyphs to yield warped text.
Suitable transformations include bilinear and perspective transforms of a curve. In many embodiments a preferred transformation is the bilinear transformation, which, in contrast to the perspective transformation, results in a more even rendering of the characters and, in particular, alignment of the medians of adjacent characters. An exemplary procedure is described for calculation of the bilinear transformation of a linear curve and of a cubic polynomial curve. In particular, a linear curve is transformed into a quadratic curve, and a cubic polynomial, which may be a Bezier curve, is transformed into a sixth-order polynomial curve. Furthermore, these transformations are advantageously performed by suitable non-linear transforms described below as well as in the pending patent application xe2x80x9cMethod and Apparatus for Transforming and Rendering Graphical Curves,xe2x80x9d referenced above.
In other words, the invention teaches a system and method in which the curvature of the baseline can be used to calculate one or more quads corresponding to the glyph-rectangles used as a reference for the curves defining a particular glyph. The coordinates of a quad allow a convenient transformation of the curves defining the glyph outline in the corresponding glyph-rectangle. Thus, glyphs are conveniently transformed from a straight reference line context into a form suitable for a curved reference line and in a manner sensitive to the local curvature of the curved reference line, resulting in an aesthetically pleasing rendering of text strings without the need to define additional fonts or glyphs. These transformations can be made by implementing suitable Application Programming Interfaces (APIs) for the benefit of programmers and interested users.
Additional features and advantages of the invention will be made apparent from the following detailed description of illustrative embodiments which proceeds with reference to the accompanying figures.